 //
//  SJPApplyCell.m
//  SWS_Project00
//
//  Created by 马继鵬 on 17/3/10.
//  Copyright © 2017年 SWS. All rights reserved.
//

#import "SJPApplyCell.h"
#import "SJPApplyModel.h"
@interface SJPApplyCell()
@property (weak,nonatomic) UILabel* nameLabel;
@property (weak,nonatomic) UILabel* illLabel;
@property (weak,nonatomic) UILabel* timeLabel;
@property (weak,nonatomic) UILabel* doctorLabel;
@property (weak,nonatomic) UILabel* titleLabel;
@property (weak,nonatomic) UILabel* hospitalLabel;
@property (weak,nonatomic) UILabel* statueLabel;

@end
@implementation SJPApplyCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        [self setupUI];
        
    }
    return self;
}

-(void)setupUI{
    
#pragma
#pragma-添加姓名Label
    UILabel* nameLabel = [UILabel EPM_labelWithTitle:nil textColor:[UIColor blackColor] font:17];
    _nameLabel = nameLabel;
    [nameLabel sizeToFit];
    [self.contentView addSubview:nameLabel];
    
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.top.offset(17);
    }];
    
#pragma
#pragma-添加病例标签
    UILabel* illLabel = [UILabel EPM_labelWithTitle:nil textColor:[UIColor blackColor] font:17];
    _illLabel = illLabel;
    [illLabel sizeToFit];
    [self.contentView addSubview:illLabel];
    [illLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(nameLabel);
        make.leading.equalTo(nameLabel.mas_trailing).offset(17);
    }];

#pragma
#pragma-添加状态栏
    UILabel* statueLabel = [UILabel EPM_labelWithTitle:nil textColor:[UIColor blackColor] font:17];
    ;
    _statueLabel = statueLabel;
//    statueBtn.titleLabel.textAlignment = NSTextAlignmentCenter;
    [statueLabel setBackgroundColor:kThemeColor];
    [self.contentView addSubview:statueLabel];
    
    [statueLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.offset(0);
        make.trailing.offset(0);
        make.width.height.mas_equalTo(60);
    }];
   statueLabel.layer.cornerRadius = 30;
    statueLabel.layer.masksToBounds = YES;
#pragma
#pragma-添加就诊时间标签
    UILabel* timeLabel = [UILabel EPM_labelWithTitle:nil textColor:[UIColor blackColor] font:17];
    _timeLabel = timeLabel;
    [timeLabel sizeToFit];
    [self.contentView addSubview:timeLabel];
    [timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(illLabel);
        make.trailing.equalTo(statueLabel.mas_leading);
    }];
#pragma
#pragma-添加分割线
    UIImageView* lineView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"fengexian"]];
    [self.contentView addSubview:lineView];
    [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.offset(17);
        make.centerY.offset(0);
        make.trailing.equalTo(statueLabel.mas_leading);
        make.height.mas_equalTo(1);
    }];
    
#pragma
#pragma-添加医生label
    UILabel* doctorLabel = [UILabel EPM_labelWithTitle:nil textColor:[UIColor blackColor] font:17];
    _doctorLabel = doctorLabel;
    [doctorLabel sizeToFit];
    [self.contentView addSubview:doctorLabel];
    [doctorLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.equalTo(nameLabel);
        make.top.equalTo(lineView.mas_bottom).offset(7);
    }];
    
#pragma
#pragma-添加职位标签
    UILabel* titlelLabel = [UILabel EPM_labelWithTitle:nil textColor:[UIColor blackColor] font:17];
    _titleLabel = titlelLabel;
    [titlelLabel sizeToFit];
    [self.contentView addSubview:titlelLabel];
    [titlelLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(doctorLabel);
        make.leading.equalTo(doctorLabel.mas_trailing).offset(17);
    }];
    
#pragma
#pragma-医院标签
    UILabel* hospitialLabel = [UILabel EPM_labelWithTitle:nil textColor:[UIColor blackColor] font:17];
    _hospitalLabel = hospitialLabel;
    [hospitialLabel sizeToFit];
    [self.contentView addSubview:hospitialLabel];
    [hospitialLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.trailing.equalTo(timeLabel);
        make.centerY.equalTo(titlelLabel);
    }];
    
    self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    
}

#pragma
#pragma-设置model
- (void)setModel:(SJPApplyModel *)model
{
    _model = model;
    _nameLabel.text = model.name;
    _illLabel.text = model.ill;
    _timeLabel.text = model.time;
    _statueLabel.text = model.statue;
    _doctorLabel.text = model.doctor;
    _titleLabel.text = model.title;
    _hospitalLabel.text = model.hospital;
}
@end
